-
Notifications
You must be signed in to change notification settings - Fork 643
Permit '+' in feature name, as in "c++20" #2510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
We permit "c++20" and "dependency/c++20". But we do not permit "c++20/feature". In a Cargo.toml these would appear as: [features] default = ["c++20"] "c++20" = ["my-dependency/c++20"]
r? @smarnach (rust_highfive has picked a reviewer for you, use r? to override) |
If cargo already supports this, then I see no issue and the implementation looks good to me. Do you know if older versions of cargo will also handle this correctly? I've added this to the agenda for our team meeting on Friday to get broader consensus for the change. |
Thanks @jtgeibel. Yes, every version of Cargo from 1.0.0 to present is able to handle this correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the implementation and the cleanup. This looks all good to me.
We discussed this in the team meeting, and nobody voiced any concerns about this change, so I'm merging this now, and it will go to production soon.
@bors r+ |
📌 Commit 5f842f7 has been approved by |
☀️ Test successful - checks-travis |
Up front: I am familiar with the several discussions linked by rust-lang/crates-io-cargo-teams#41 (comment), and the conversation beginning at #1331 (comment). This PR is not motivated by attempting to match whatever behavior Cargo currently has. Instead, it's a small thing I think we can decide now whether to allow. But it's necessary to say no corresponding Cargo change is required to accommodate this crates.io change.
This PR updates feature validation during publish to accept e.g. "c++20" and "dependency/c++20". We continue to not accept "c++20/feature" as the prefix before the slash would normally refer to a crate name of a dependency and a '+' would not be allowed in those.
I am interested in using such feature names in https://github.com/dtolnay/cxx.
In a Cargo.toml plusses appear as:
To give some slight further justification for why this particular ascii character above other possible characters we might allow:
+
is pretty common in OS package names in a way that no other currently disallowed character is. Some examples pulled arbitrarily fromapt-cache pkgnames | rg '\+'
:The actual names of the projects contain
+
; various ones in the descriptions in the above links are styled as ARPACK++, Memtest86+, Magics++, Paw++, MinSat+, SWISH++, Vera++, Voro++. When binding to something like this behind a feature, using+
in the feature name is the most intuitive.